def install_no_package(package):
    try:
        importlib.util.find_spec(package)
    except ModuleNotFoundError:
        import subprocess

        # 安装
        print(f"#pip install {package}")

        result = subprocess.run(
            [sys.executable, "-s", "-m", "pip", "install", package],
            capture_output=True,
            text=True,
        )

        # 检查命令执行结果
        if result.returncode == 0:
            print("#install success")
        else:
            print("#install error")


needPackages = ["mail"]
for package in needPackages:
    install_no_package(package)
